package com.hy.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 五子棋对局信息
 * @TableName game_gobang_record
 */
@TableName(value ="game_gobang_record")
@Data
public class GameGobangRecord implements Serializable {
    /**
     * 对局id
     */
    @TableId
    private Long id;

    /**
     * 玩家1
     */
    private Long player1;

    /**
     * 玩家2
     */
    private Long player2;

    /**
     * 获胜玩家id
     */
    private Long winPlayer;

    /**
     * 开始时间
     */
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    private LocalDateTime endTime;

    /**
     * 对局回放数据(json)
     */
    private String playBack;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        GameGobangRecord other = (GameGobangRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPlayer1() == null ? other.getPlayer1() == null : this.getPlayer1().equals(other.getPlayer1()))
            && (this.getPlayer2() == null ? other.getPlayer2() == null : this.getPlayer2().equals(other.getPlayer2()))
            && (this.getWinPlayer() == null ? other.getWinPlayer() == null : this.getWinPlayer().equals(other.getWinPlayer()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getPlayBack() == null ? other.getPlayBack() == null : this.getPlayBack().equals(other.getPlayBack()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPlayer1() == null) ? 0 : getPlayer1().hashCode());
        result = prime * result + ((getPlayer2() == null) ? 0 : getPlayer2().hashCode());
        result = prime * result + ((getWinPlayer() == null) ? 0 : getWinPlayer().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getPlayBack() == null) ? 0 : getPlayBack().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", player1=").append(player1);
        sb.append(", player2=").append(player2);
        sb.append(", winPlayer=").append(winPlayer);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", playBack=").append(playBack);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}